package ar.edu.itba.it.cg.grupo01.game.action;

import ar.edu.itba.it.cg.grupo01.game.sound.Pioneer;
import ar.edu.itba.it.cg.grupo01.game.sound.PioneerSoundSystem;
import ar.edu.itba.it.cg.grupo01.vehicle.Car;
import com.jme.input.action.InputActionEvent;
import com.jme.input.action.InputActionInterface;


public class AccelAction implements InputActionInterface {
    
	Car car;
    int direction;
    Pioneer audio;
    
    public AccelAction(Pioneer audioSystem, final Car car, final int direction) {
        this.car = car;
        this.direction = direction;
        this.audio = audioSystem;
    }

	public void setCar(Car car) {
		this.car = car;
	}


	public void performAction(final InputActionEvent e) {
        // If the key has just been pressed, lets accelerate in the desired
        // direction
        if (e.getTriggerPressed()) {
            car.accelerate(direction);
//            audio.playEffect(PioneerSoundSystem.ACCELERATION, false);
        }
        // Otherwise, lets release the wheels.
        else {
            car.releaseAccel();
        }
        
    }
}
